<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>采购退货</title>

<link href="../resources/css/ligerui-all.css" rel="stylesheet" type="text/css" />

<script src="../resources/js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="../resources/js/ligerui.min.js" type="text/javascript"></script>

<script type="text/javascript">

	
	var projectNameList = { Rows: [{ "projectNameID": 1, "projectName": "牛肉"}, { "projectNameID": 2, "projectName": "火腿肠" }]};
	
	var unitList = { Rows: [{ "unitID": 1, "unitName": "公斤"}, { "unitID": 2, "unitName": "瓶" }]};
	
	var data = { Rows: [{"purchaseID": 1, "projectName": "番薯", "unit": "公斤", "unitPrice": "4.8", "numberOfProduct": 5, "singleTotalPrice": 24},{"purchaseID": 2, "projectName": "腊肠", "unit": "公斤", "unitPrice": "61", "numberOfProduct": 10, "singleTotalPrice": 610} ], Total: 2 };
	
	
	
	$(function ()
        {  
            f_initGrid();  
        });
        function f_initGrid()
        {
            $("#purchaseGoods").ligerGrid({
                columns: [
                { display: '编号', name: 'purchaseID', width: 50, type: 'int' },
                { display: '项目名称', name: 'projectName', isSort: false, editor: { type: 'select', data: projectNameList.Rows, dataValueField: 'projectNameID', dataDisplayField: 'projectName', valueColumnName: 'projectNameID' }},
				{ display: '单位', name: 'unit', width: 80, isSort: false, editor: { type: 'select', data: unitList.Rows, dataValueField: 'unitID', dataDisplayField: 'unitName', valueColumnName: 'unitID' }},
                { display: '单价', name: 'unitPrice', width: 80, editor: { type: 'text'}},
                { display: '商品数量', name: 'numberOfProduct', default: 1, width: 80, editor: { type: 'int'} },
                { display: '金额', name: 'singleTotalPrice', width: 80, editor: { type: 'text'} }
                ],
                enabledEdit: true, usePager: false, isScroll: false,
                data:data,
                width: '100%'
            });
        }
		
		function addNewRow()
        {
            var manager = $("#purchaseGoods").ligerGetGridManager();
            manager.addRow();
        } 
		function deleteRow()
        {
            var manager = $("#purchaseGoods").ligerGetGridManager();
            manager.deleteSelectedRow();
        }
		/**获取选中的值**/
		 function getSelected()
        {
            var manager = $("#purchaseGoods").ligerGetGridManager();
            var row = manager.getSelectedRow();
            alert(JSON.stringify(row));
        }
		/**获取全部值**/
        function getData()
        {
            var manager = $("#purchaseGoods").ligerGetGridManager();
            var data = manager.getData();
            alert(JSON.stringify(data));
        }
</script>
<style type="text/css">
		#isr { margin-left:5px;}
    	#tdMsg{ width:90px; text-align:right;}
		#trMsg { height:28px;}
		.l-table-edit-td{ padding:4px;}
		.l-button-submit,.l-button-reset{width:80px; height:20px; float: right; margin-left:10px;}
</style>
</head>

<body>
	<div id="isearch">
    	<form action="" method="post">
    	<table border="0" cellpadding="1" cellspacing="1" width="700">
         	<tr id="trMsg">
            	<td colspan="6" align="left">
                	<div style="margin-left:5px; font-size:14px;  font-weight:bold;">>>填写退货单</div>
                </td>
            </tr>
        	<tr id="trMsg">
            	<td id="tdMsg" class="l-table-edit-td">货单编号：</td>
                <td class="l-table-edit-td">
                	<input type="text" name="id" value="TH832493290498739" disabled="disabled" readonly="readonly"/>
                </td>
            	<td id="tdMsg" class="l-table-edit-td"></td>
                <td class="l-table-edit-td">
                </td>
                <td id="tdMsg" class="l-table-edit-td"></td>
                <td class="l-table-edit-td">
                </td>
            </tr>
            <tr id="trMsg">
            	<td id="tdMsg" class="l-table-edit-td">供货商：</td>
                <td class="l-table-edit-td">
                	<input type="text" name="name" id="txtName" ltype="text" /></td>
            	<td id="tdMsg" class="l-table-edit-td">退货仓库：</td>
                <td class="l-table-edit-td"> 
                    <select name="category" disabled="disabled">
                        <option value="-1" selected="selected">宝华仓库</option>
                    </select>
                </td>
                <td id="tdMsg" class="l-table-edit-td">填单日期：</td>
                <td class="l-table-edit-td">
                	<input type="text" name="currentInventory"/></td>
                
            </tr>
            <tr id="trMsg">
            	<td id="tdMsg" class="l-table-edit-td">应收账款：</td>
                <td class="l-table-edit-td">
                	<input type="text" name="id"/>
                </td>
            	<td id="tdMsg" class="l-table-edit-td">实收账款：</td>
                <td class="l-table-edit-td"><input type="text" name="id"/>
                </td>
                <td id="tdMsg" class="l-table-edit-td">经手员工：</td>
                <td class="l-table-edit-td"><input type="text" name="id" value="Lucy" disabled="disabled" readonly="readonly"/>
                </td>
            </tr>
            <tr id="trMsg">
            	<td align="right">
               		货单备注：
                </td>
                <td colspan="5" class="l-table-edit-td">
               		<textarea cols="100" rows="1"></textarea>
                </td>
            </tr>
            <tr id="trMsg">
            	<td colspan="6" align="right">
               		<input type="reset" value="清  空" name="reset"  class="l-button l-button-reset"/>
                	<input type="submit" value="保  存" name="submit" class="l-button l-button-submit"/>
					<a class="l-button" style="width:100px; height:18px; float:right; margin-left:10px;" onclick="deleteRow()">删除退货商品</a><a class="l-button" style="width:100px; height:18px; float:right; margin-left:10px;" onclick="addNewRow()">添加退货商品</a>	
                	
                </td>
            </tr>
        </table>
    	</form>
    </div>
    <div id="purchaseGoods" style="margin-left:5px;"></div>
    
    <!--
     <br />
   <a class="l-button" style="width:120px" onclick="getSelected()">获取选中的值(选择行)</a>
 
   <br />
   <a class="l-button" style="width:120px" onclick="getData()">获取当前的值</a>
  -->

</body>
</html>
